import { ADD,MINUS} from '@/action-types';
import {CounterAction} from '../actions/counterAction'
export interface CounterState {
    count:number
}
let initialState: CounterState = { count: 0 };
export default function (state: CounterState = initialState, action: CounterAction):CounterState{
    
    
    switch(action.type){
        case ADD:
            return { ...state, count: state.count + 1 };
        case MINUS:
            return { ...state, count: state.count - 1 };
        default:
            return state;
    } 
}   